<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            padding: 0;
            margin: 0;
        }

        #app {
            box-sizing: border-box;
            padding: 10px;
        }
        header{
            font-size: 26px;
            font-weight: 700;
        }
        header div{
            margin-top: 15px;
            display: flex;
            justify-content: space-between;
        }
        header input{
            width: 80%;
            border-radius: 15px;
            outline: none;
            vertical-align: middle;
            height: 24px;
            line-height: 24px;
            padding-left: 10px;
        }
        header .search{
            font-size: 18px;
            margin-left: 10px;
            background-color: #fff;
            border: none;
        }
        h4{
            margin-top: 10px;
        }
        .find{
            /* width: 100%; */margin-right: 10px;
            min-height: 50px;
        }
        .find span{
            padding:0 10px;
            display: inline-block;
            margin: 10px 0;
            height: 30px;
            line-height: 30px;
            background-color: rgb(231, 231, 231);
            font-size: 16px;
        }
        section{
        display: flex; 
        /* justify-content: space-between; */
        flex-wrap: wrap;
        }
    </style>
</head>

<body>
    <div id="app">
        <header>
            <span style="color: rgb(106, 203, 241);"><</span>&nbsp;搜索
            <div>
                <input v-model="text" type="text" placeholder="请输入搜索的内容"> <button class="search" style="color: rgb(106, 203, 241);" @click="search">搜索</button>
            </div>
        </header>
        <h4>历史搜索</h4>
        <section>
            <div class="find"  v-for="(item,index) in list" :key="index">
                <span>{{item}}</span>
            </div>
        </section>
        <h4>搜索发现</h4>
        <div class="find">
            <span>麻辣烫</span>
            <span>米线</span>
            <span>匹萨</span>
            <span>蛋糕</span>
            <span>汉堡</span>
            <span>烧烤</span>
            <span>烤肉拌饭</span>
            <span>炸鸡</span>
            <span>味多美</span>
        </div>
        
    </div>
</body>

</html>
<script src="./vue-2.5.21.js"></script>
<script>
    var v = new Vue({
        el: "#app",
        data: {
            text:"",
            list:[]
        },
        methods: {
           search(){
            console.log(this.text);
            this.list.unshift(this.text)
            this.text = "";
           }
        },
    })
</script>